﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>

<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">

    <div class="panel panel-default x-panel x-panel-layout">

      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/ecommerce">电商管理</a></li>
          <li class="active">课程排期</li>
          <li class="no-before pull-right" style="min-width: 65px;">
            <a onclick="window.history.back();"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;&nbsp;返回</a>
          </li>
        </ol>
      </div>

      <div class="panel-body">

        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>

        <div class="col-xs-10 x-panel-layout-right">

          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire" title="团课详情"></i>&nbsp;&nbsp;<span>课程排期&nbsp;-&nbsp;团课详情</span></h2>
            </div>
          </div>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>基本信息</span>
                <a href="${ctx.host}/group-rounds/${courseRounds[0].code}/edit" data-toggle="modal" data-target="#group-round-edit" dataclass="hover-no-text-decoration" style="position: absolute; right: 0px; top: 0px; margin-top: 10px; margin-right: 10px;" title="编辑信息">编辑信息</a>
              </h2>
            </div>
          </div> 
          
          <div class="clearfix">
          
          <div class="form-horizontal x-form-horizontal" style="width: 50%; float: left">
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">团课编号：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds[0].groupAttr.description}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">操房：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds[0].groupAttr.gym}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">开课时间：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds[0].groupAttr.openDescription}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">课程：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds[0].course.name}(${courseRounds[0].course.weeks}周${courseRounds[0].course.hours}课时)</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">课程人数：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds.size()}</p>
              </div>
            </div>
            <div class="form-group">
              <label class="control-label col-xs-4 text-right">课程地点：</label>
              <div class="col-xs-6">
                <p class="form-control-static">${courseRounds[0].site.name}</p>
              </div>
            </div>
            
          </div>
          
          <div class="pull-right" style="width: 50%;">
            <table class="table table-striped table-hover x-table schedule-table" data-toggle="table">
              <thead>
                <tr>
                  <th>日期</th>
                  <th>时间段</th>
                  <th>教练</th>
                  <th class="text-center">操作</th>
                </tr>
              </thead>
              <tbody>
                <c:set value="${courseRounds[0].code}" var="code"></c:set>
                <c:forEach var="schedule" items="${courseRounds[0].schedules}">
                  <c:if test="${schedule.occurDate == null}">
                    <tr>
                      <td colspan="4">
                        暂未排期
                      </td>
                    </tr>
                  </c:if>
                  <c:if test="${schedule.occurDate != null}">
                    <tr>
                      <td><fmt:formatDate value="${schedule.occurDate}" pattern="yyyy-MM-dd"/></td>
                      <td>${schedule.occurHour}</td>
                      <td>
                        ${schedule.coach.name == null ? '暂未指定' : schedule.coach.name}
                      </td>
                      <td class="text-center">
                        <a href="${ctx.host}/group-rounds/${code}/bind-coach?dayhour=${schedule.dayhour}" data-toggle="modal" data-target="#bind-coach">指定教练</a>&nbsp;&nbsp;
                        <a href="${ctx.host}/group-rounds/${code}/change-time?dayhour=${schedule.dayhour}" data-toggle="modal" data-target="#change-time">更改时间</a>
                      </td>
                    </tr>
                  </c:if>
                </c:forEach>
              </tbody>
            </table>
          </div>
          
          </div>
          
          <div class="x-breadcrumb-wrapper" style="margin-top:20px;">
            <div class="x-breadcrumb yellow clearfix">
              <h2>
                <span>学员信息</span>
              </h2>
              <a href="${ctx.host}/group-rounds/${courseRounds[0].code}/rounds/create" data-toggle="modal" data-target="#student-create" class="pull-right" style="margin-right: 10px; margin-top: 10px;" title="添加">添加学员</a>
            </div>
          </div>
          
          <table class="table table-striped table-hover x-table" style="margin-bottom:20px;">
            <thead>
              <tr>
                <th>学员名称</th>
                <th>联系方式</th>
                <th class="text-center">操作</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="courseRound" items="${courseRounds}">
                <c:if test="${not courseRound.finish}">
                  <tr>
                    <td>${courseRound.student.name}</td>
                    <td>${courseRound.student.mobile}</td>
                    <td class="text-center">
                      <c:choose>
                        <c:when test="${courseRound.courseStatus.prepare}">
                          <a href="${ctx.host}/group-rounds/${courseRound.code}/rounds/${courseRound.id}/remove" data-toggle="modal" data-target="#course-drop">移除学员</a>
                        </c:when>
                        <c:otherwise>
                          <a href="${ctx.host}/group-rounds/${courseRound.code}/rounds/${courseRound.id}/drop" data-toggle="modal" data-target="#course-drop">退课</a>&nbsp;&nbsp;
                          <a href="${ctx.host}/group-rounds/${courseRound.code}/rounds/${courseRound.id}/transfer" data-toggle="modal" data-target="#course-transfer">转团</a>
                          <c:if test="${courseRound.courseStatus.ready and !currentPrincipal.siteServer}">
                            &nbsp;&nbsp;<a href="${ctx.host}/group-rounds/${courseRound.code}/rounds/${courseRound.id}/stop-camp" data-toggle="modal" data-target="#course-stop-camp">手动结营</a>
                          </c:if>
                        </c:otherwise>
                      </c:choose>
                    </td>
                  </tr>
                </c:if>
              </c:forEach>
            </tbody>
          </table>
          
        </div>
          
        </div>

      </div>

    </div>

  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/course/group-round-view.js">
    <script type="text/javascript">
      require(['page/course/group-round-view'], function(page) {
        page.init({
        	"refundPrice": '${not empty courseRounds ? courseRounds[0].order.price/100 : 0}'
        })
      })
    </script>
  </d:resource>
</body>

</html>
